<?php    
header('Content-type: application/xls');
header("Content-Disposition:attachment;filename=danhsachphat.xls");
?>
<?php echo $this->Html->charset('UTF-8'); ?>
<?php ?>
<h2> Danh sách độc giả bị phạt</h2>
<h3><?php if ($nam==0) echo 'Từ '.$ngaybd.' đến '.$ngaykt;
            else echo 'Năm '.$nam;
?></h3>
<table border=1>
  <tr>
    <th style="background: #d5d5d5; font-weight:bold;">STT</th> 
    <th style="background: #d5d5d5; font-weight:bold;">Độc giả</th>
     <th style="background: #d5d5d5; font-weight:bold;">Ngày</th>
     <th style="background: #d5d5d5; font-weight:bold;">Hình thức xử phạt</th>
     <th style="background: #d5d5d5; font-weight:bold;">Mức phạt</th>
     <th style="background: #d5d5d5; font-weight:bold;">Ghi chú</th>
  </tr>
  <?php $i=0;?>
  <?php foreach ($chitietphats as $chitietvipham):?>
  <tr>
  	<td><?php echo ++$i ?></td>
    <td><?php echo $chitietvipham['Docgia']['maso'].' - ' . $chitietvipham['Docgia']['tennv'];?></td>
    <td><?php echo date('d-m-Y',strtotime($chitietvipham['Bienlaiphat']['ngaylap']))?></td>
    <td><?php echo $chitietvipham['Hinhthucxuphat']['tenhtxp']?></td>
    <td><?php echo number_format($chitietvipham['Chitietvipham']['mucphat'],0,'','.')?></td>
    <td><?php echo $chitietvipham['Chitietvipham']['ghichu']?></td>
  </tr>
  <?php endforeach;?>
</table>